<?php

namespace app\api\controller;

use app\admin\model\Config;
use app\common\controller\ApiBase;
use app\Constant\ApiConstant;
use think\response\Json;

class Aggregation extends ApiBase
{
	/**
	 * 活动列表
	 *
	 * @return Json
	 */
	public function activityList(): Json
	{
		// 查询聚推客联盟活动列表
		$activityList = Config::where('group', Config::GROUP_AGGREGATION_TUIKE)
			->where('name', Config::NAME_ACTIVITY_LIST)
			->value('value');
		$activityList = json_decode($activityList, true);
		if (empty($activityList)) {
			return $this->callback(ApiConstant::SUCCESS, 'success');
		}

		$resultData = [
			'list' => $activityList,
		];
		return $this->callback(ApiConstant::SUCCESS, 'success', $resultData);
	}
}